package com.clarte.feeType.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.clarte.common.dao.BaseDao;
import com.clarte.model.FeeType;
@Service("feeTypeService")
@Transactional
public class FeeTypeServiceImpl implements FeeTypeService {
	@Resource(name="baseDao")
	private BaseDao<FeeType, Integer> baseDao;
	
	@Override
	public void addFeeType(FeeType feeType) {
		baseDao.save(feeType);
	}

	@Override
	public void delFeeType(Integer... id) {
		baseDao.delete(id);
	}

	@Override
	public void editFeeType(FeeType feeType) {
		baseDao.update(feeType);
	}

	@Override
	public List<FeeType> findAll() {
		return baseDao.findAll();
	}

	@Override
	public boolean isExist(String code) {
		long l = baseDao.getTotal("select count(*) from FeeType t where t.code = ?", new String []{code});
		return l > 0;
	}

}
